/**
 * 扩展cc.Toggle功能，使其能在true和false时分别触发事件
 */
cc.Class({
    extends: cc.Component,

    properties: {
        trueEvents:{
            default: [],
            type:[cc.Component.EventHandler],
            tooltip:'当Toggle变为true时触发'
        },
        falseEvents:{
            default: [],
            type:[cc.Component.EventHandler],
            tooltip:'当Toggle变为false时触发'
        },
    },
    /**
     * 响应原始cc.Toggle发来的事件
     * @param {*} e 
     * @param {*} customData 
     */
    onToggleChanged(e, customData){
        var events = (e.isChecked === false)?this.falseEvents:this.trueEvents;
        cc.Component.EventHandler.emitEvents(events, e);
    },
    testOnTrue(e, customData){
        cc.log(customData);
    },
    testOnFalse(e, customData){
        cc.log(customData);
    },
});
